#include<iostream>

#include<list>

using namespace std;

void test_list1()
{
  list<int>l1;
  l1.push_back(1);
  l1.push_back(2);
  l1.push_back(3);
  l1.push_back(4);
  l1.push_back(5);

  for(auto li:l1){
    cout<<li<<" ";
  }
  cout<<endl;

  list<int>::iterator it = l1.begin();
  while(it!=l1.end()){
    cout<<*it<<" ";
    ++it;
  }

  cout<<endl;
}

int main()
{
//stl中的list是一个双向循环链表;
//允许常数时间在任意位置进行插入删除
test_list1();
  return 0;
}
